package cn.et.food.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import cn.et.food.dao.FoodDao;
import cn.et.food.entity.Food;
import cn.et.food.mapper.FoodMapper;


@Repository
public class FoodDaoImpl implements FoodDao {

	@Autowired
	private FoodMapper mapper;
	
	/**
	 * 新增菜品
	 * @param foodName
	 * @param price
	 */
	public void saveFood(String foodName , String price){
		mapper.saveFood(foodName, price);
	}
	
	/**
	 * 删除菜品
	 * @param foodId
	 */
	public void deleteFood(String foodId){
		mapper.deleteFoodById(foodId);
	}
	
	/**
	 * 修改菜品信息
	 * @param foodId
	 * @param foodName
	 * @param price
	 */
	public void updateFood(String foodId, String foodName , String price){
		mapper.updateFood(foodId, foodName, price);
	}
	
	/**
	 * 根据菜品名模糊查询
	 * @param foodName
	 * @return
	 */
	public List<Food> queryFoodsByName(String foodName){
		return mapper.queryFoodsByName(foodName);
	}
	
	/**
	 * 根据Id查询菜品
	 * @param foodId
	 * @return
	 */
	public Food queryFoodById(String foodId){
		return mapper.queryFoodById(foodId);
	}
}
